<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<script type="text/javascript">
 $(function(){
	//初始化表单验证
	$("#addForm").validate({
		rules: {
			marketPrice: {isMoney: true},
			sellPrice: {isMoney: true},
			sellerprice: {isMoney: true},
			
			oppoint: {isMoney: true},
			opdedu: {isMoney: true},
			opcoupon: {isMoney: true},
			
			muchsellerprice: {isMoney: true},
			mppoint: {isMoney: true},
			mpdedu: {isMoney: true},
			mpcoupon: {isMoney: true},
			
			price:{isMoney: true},
/* 			stock:{digits: true}, */		
			zdsx:{digits: true},
			yyts:{digits: true},
			jyrs:{digits: true},
			zdrs:{digits: true},	
		},
		messages: {
			name: {required: "请输入商品标题"},
			
			marketPrice: {required: "请输入商品分公司价",isMoney: "请填写正确的金额，最多保留两位小数位"},
			sellerprice: {required: "请输入支付金额",isMoney: "请填写正确的支付金额，最多保留两位小数位"},
			sellPrice: {required: "请输入支付金额",isMoney: "请填写正确的支付金额，最多保留两位小数位"},
			oppoint: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			opdedu: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			opcoupon: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			
			muchsellerprice: {required: "请输入支付金额",isMoney: "请填写正确的支付金额，最多保留两位小数位"},
			mppoint: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			mpdedu: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			mpcoupon: {required: "请输入数字",isMoney: "请填写正确的积分值，最多保留两位小数位"},
			
			price: {required: "请输入价值",isMoney: "请填写正确的价值，最多保留两位小数位"},
			
		/* 	stock: {required: "请输入商品库存",digits: "请填写正确的数量"}, */
			zdsx: {required: "请输入正确的指定上限",digits: "请填写正确的数量"},
			yyts: {required: "请输入商品库存",digits: "请填写正确的数量"},
			jyrs: {required: "请输入正确的建议",digits: "请填写正确的数量"},
			zdrs: {required: "请输入正确的指定人数",digits: "请填写正确的数量"},
		},
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success:function(data){
					switch(data.flag){
					case 2:
						Kit.alert("请选择商品分类");return;
					case 6:
						Kit.alert("最少添加一个规格");return;
					case 7:
						Kit.alert("Logo图片不能为空！");return;
					case 8:
						Kit.alert("请添加价格");return;
					case 9:
						Kit.alert("请添加客服二维码");return;
					case 10:
						Kit.alert("请填写宝贝内容");return;
					case 12:
						Kit.alert("请点击添加轮播图片，进行图片的添加！");return;
					case 13:
						Kit.alert("请点击添加详情图片，进行图片的添加！");return;
					case 14:
						Kit.alert("添加规格错误");return;
					case 19:
						Kit.alert("已选中支付积分值，请填写积分值");return;
					case 20:
						Kit.alert("请至少选择一种支付方式");return;
					/* case -1:
						Kit.alert("网络繁忙...，请重试");return;  */
					case  -1:
						dataPaginator.loadPage(1);
						addDialog.close();
						return;
					}
				}
			});
		}
	});
}); 
  var addStoreDialog;
function addStore(){
	addStoreDialog = Kit.dialog("添加分公司","${BASE_PATH}/exchange/goods/chooseStore",{closable:true,size:'size-wide'}).open();
}  
function onStoreChoosed(id,title,address,tel){
	var trs= $("#tablea tr");
	var array=new Array();
	var numb=parseFloat($("#chooseNum").html());
	for (var i = 0; i < trs.length; i++) {
		var tds = $(trs[i]).children();
		var sid = $(tds[0]).find("#ids").val();
		array.push(sid);
	}
	if(contains(array,id)){
		alert("该分公司已添加");
	}else{
	 var tr="<tr><td style=\"font-size: 14px;text-align: center;\"><input type=\"checkbox\" id=\"ids\" checked=\"checked\" name=\"checks\" value='"+id+"'/>"+
     "</td><td style=\"font-size: 14px;text-align: center;\">"+title+
     "</td><td style=\"font-size: 14px;text-align: center;\">"+address+
     "</td><td style=\"font-size: 14px;text-align: center;\">"+tel+
     "</td></tr>";
     $("#tablea").append(tr);
     $("#chooseNum").text((numb+1));
     $("#storeid").val((numb+1));
	}
}
function contains(arr, obj) {  
    var i = arr.length;  
    while (i--) {  
        if (arr[i] === obj) {  
            return true;  
        }  
    }  
    return false;  
} 
$("#payonlyactivity").hide();
$("#oppoint").hide();
$("#opdedu").hide();
$("#opcoupon").hide();
$("#paymoneyandactivity").hide();
$("#muchsellerprice").hide();
$("#mppoint").hide();
$("#mpdedu").hide();
$("#mpcoupon").hide();

$(".mpay").click(function(){
	var v = $('input[name="multipay"]').filter(':checked').val(); 
	if(v==2){
		$("#sellerprice").hide();
		$("#sellerprice").val("");
		$("#paymoneyandactivity").hide();
		$("#mppoint").val("");
		$("#mpdedu").val("");
		$("#mpcoupon").val("");
		$("#payonlyactivity").show();
		$("#payonlyactivity").click(function(){
			 var vs = $('input[name="onlypaypoint"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#oppoint").show();
			 }else{
				 $("#oppoint").hide();
				 $("#oppoint").val("");
			 }
			 var vs = $('input[name="onlypaydedu"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#opdedu").show();
			 }else{
				 $("#opdedu").hide();
				 $("#opdedu").val("");
			 }
			 var vs = $('input[name="onlypaycoupon"]').filter(':checked').val(); 
			 if(vs==1){
				 $("#opcoupon").show();
			 }else{
				 $("#opcoupon").hide();
				 $("#opcoupon").val("");
			 }		 
		});
	}else if(v==3){
		$("#sellerprice").hide();
		$("#sellerprice").val("");
		$("#payonlyactivity").hide();
		$("#oppoint").val("");
		$("#opdedu").val("");
		$("#opcoupon").val("");
		$("#paymoneyandactivity").show();
		$("#paymoneyandactivity").click(function(){
			var vsp= $('input[name="mpayprice"]').filter(':checked').val(); 
			if(vsp==1){
				$("#muchsellerprice").show();
			}else{
				$("#muchsellerprice").hide();
				$("#muchsellerprice").val("");
			}
			var vsp= $('input[name="mpaypoint"]').filter(':checked').val(); 
			if(vsp==1){
				$("#mppoint").show();
			}else{
				$("#mppoint").hide();
				$("#mppoint").val("");
			}
			var vsd = $('input[name="mpaydedu"]').filter(':checked').val(); 
			if(vsd==1){
				$("#mpdedu").show();
			}else{
				$("#mpdedu").hide();
				$("#mpdedu").val("");
			}
			var vsc = $('input[name="mpaycoupon"]').filter(':checked').val(); 
			if(vsc ==1){
				$("#mpcoupon").show();
			}else{
				$("#mpcoupon").hide();
				$("#mpcoupon").val("");
			}		 
		});
	}
});
 var imagesDialogs;
 function toUploadImages(){
 	imagesDialogs = Kit.dialog("轮播图片","${BASE_PATH}/exchange/goods/imageIndex/${LunBoNum}",{closable:true,size:"size-wide"}).open();
 	
 }
  /* 添加规格 */
  function addSpec(){
		var trs= $("#tablespec tr");
		var array=new Array();
		var numb=parseFloat($("#chooseSpecNum").html());
		for (var i = 0; i < trs.length; i++) {
			var tds = $(trs[i]).children();
			var sid = $(tds[1]).find("#KspecName").val();
			console.log("sid===sid==>"+sid);
			array.push(sid);
		}
		var id = array.length +1;
		console.log("id===id==>"+id);
		var specName = $("#specName").val(); //商品规格名称
		var specNum = $("#specNum").val();  //此规格商品的数量
		var marketPrice = $("#marketPrice").val();  //分公司分公司价
		var stock = $("#stock").val(); //库存数量

		var multipay = $('input[name="multipay"]').filter(':checked').val();//多支付类型2.单优惠3.组合

		var onlypaypoint = $('input[name="onlypaypoint"]').filter(':checked').val(); //单独优惠支付积分值类型值
		var oppoint = $("#oppoint").val(); //单独优惠支付积分值值
		var onlypaydedu = $('input[name="onlypaydedu"]').filter(':checked').val(); //单独优惠支付抵扣券类型值
		var opdedu = $("#opdedu").val(); //单独优惠支付抵扣券值		
		var onlypaycoupon = $('input[name="onlypaycoupon"]').filter(':checked').val(); //单独优惠支付优惠券类型值
		var opcoupon = $("#opcoupon").val(); //单独优惠支付积教育分值
		var mpayprice = $('input[name="mpayprice"]').filter(':checked').val();//组合货币支付类型值
		var muchsellerprice = $("#muchsellerprice").val(); //组合支付货币支付价格
		var mpaypoint = $('input[name="mpaypoint"]').filter(':checked').val(); //组合支付积分值类型值
		var mppoint = $("#mppoint").val(); //组合支付积分值值
		var mpaydedu = $('input[name="mpaydedu"]').filter(':checked').val(); //组合支付抵扣券类型值
		var mpdedu = $("#mpdedu").val(); //组合支付抵扣券值		
		var mpaycoupon = $('input[name="mpaycoupon"]').filter(':checked').val(); //组合支付优惠券类型值
		var mpcoupon = $("#mpcoupon").val(); //组合支付优惠券值
		
		
		var optotal = "无";//全部的单优惠方式
		var opoint = "";
		var odedu = "";
		var ocoupon = "";
		var mptotal = "无";//全部的组合方式
		var mprice = "";
		var mpoint = "";
		var mdedu = "";
		var mcoupon = "";
		//判断不为空
		if (specName==""){
			Kit.alert("商品规格不能为空！");
			return;
		}else if(specNum==""){
			Kit.alert("规格商品的数量不能为空！");
			return;
		}else if(marketPrice==""){
			Kit.alert("分公司分公司价不能为空！");
			return;
		}else if(stock==""){
			Kit.alert("库存数量不能为空！");
			return;
		}
		//多种支付方式
		if(!multipay){
			Kit.alert("至少选择一种支付方式");
			return;
		} else {
			/* //判断是否是单货币支付方式
			if(multipay == 1){
				if(!sellerprice || sellerprice==0){
					Kit.alert("单货币支付方式——价格不能为空或者0！");
					return;
				}else{
					//单货币赋值
					sellerprice = sellerprice;
				}
			}else{
				sellerprice = "无";
			} */
			//判断是否是单优惠支付方式
			if(multipay == 2){
				if(!onlypaypoint && !onlypaydedu && !onlypaycoupon){
					Kit.alert("您已选择优惠支付，请选择优惠方式！");
					return;
				}else{
					//判断是否是单优惠支付积分方式
					if(onlypaypoint == 1){
						if(!oppoint || oppoint==0){
							Kit.alert("优惠支付方式——积分不能为空或者0！");
							return;
						}else{
							//支付方式为积分支付
							opoint = "积分:" + oppoint + ";";
						}
					}
					//判断是否是单优惠支付折扣方式
					if(onlypaydedu == 1){
						if(!opdedu || opdedu==0){
							Kit.alert("优惠支付方式——折扣不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							odedu = "折扣:" + opdedu + ";";
						}
					}
					//判断是否是单优惠支付优惠券方式
					if(onlypaycoupon == 1){
						if(!opcoupon || opcoupon==0){
							Kit.alert("优惠支付方式——优惠券不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							ocoupon = "优惠券:" + opcoupon;
						}
					}
				optotal = opoint + odedu  + ocoupon;//拼接字符串
				}
			}
			//判断是否为组合支付方式
			if(multipay == 3){
				if(!mpayprice && !mpaypoint && !mpaydedu && !mpaycoupon){
					Kit.alert("您已选择组合支付，请选择组合付款方式！");
					return; 
				}else if(!mpaypoint && !mpaydedu && !mpaycoupon){
					Kit.alert("您已选择组合支付，请选至少选择一种优惠方式！");
					return; 
				}else{
					//判断组合支付方式货币是否为空
					if(mpayprice == 1){
						if(!muchsellerprice || muchsellerprice == 0){
							Kit.alert("组合支付方式——货币不能为空或者0！");
							return;
						}else{
							//支付方式为积分支付
							mprice = "货币:" + muchsellerprice + "/";
						}
					}else{
						Kit.alert("组合支付方式——必须包含货币支付");
						return;
					}
					//判断是否是组合支付积分方式
					if(mpaypoint == 1){
						if(!mppoint || mppoint == 0){
							Kit.alert("组合支付方式——积分不能为空或者0！");
							return;
						}else{
							//支付方式为积分支付
							mpoint = "积分:" + mppoint + ";";
						}
					}
					//判断是否是组合支付折扣方式
					if(mpaydedu == 1){
						if(!mpdedu || mpdedu == 0){
							Kit.alert("组合支付方式——折扣不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							mdedu = "折扣:" + mpdedu + ";";
						}
					}
					//判断是否是组合支付优惠券方式
					if(mpaycoupon == 1){
						if(!mpcoupon || mpcoupon==0){
							Kit.alert("组合支付方式——优惠券不能为空或者0！");
							return;
						}else{
							//支付方式为折扣支付赋值
							mcoupon = "优惠券:" + mpcoupon;
						}
					}	
				mptotal = mprice + mpoint + mdedu + mcoupon;//拼接字符串
				}
			}
		}
		if(contains(array,specName)){
			alert("该规格已经添加！");
		}else{
			var tr="<tr><td style=\"font-size: 14px;text-align: center;\"><input type=\"checkbox\" id=\"ids\" checked=\"checked\" name=\"specChecks\" value='"+id+"'/>"+
			
			"</td><td  style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"KspecName\" hidden=\"hidden\" name=\"KspecName\"  value='"+specName+"'/>"+specName+
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"KspecNum\" hidden=\"hidden\" name=\"KspecNum\" value='"+specNum+"'/>"+specNum+
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"KmarketPrice\" hidden=\"hidden\" name=\"KmarketPrice\" value='"+marketPrice+"'/>"+marketPrice+
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Kstock\" hidden=\"hidden\" name=\"Kstock\" value='"+stock+"'/>"+stock+
			
			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Kmultipay\" hidden=\"hidden\" name=\"Kmultipay\" value='"+multipay+
				"'/><input type=\"text\" id=\"Koppoint\" hidden=\"hidden\" name=\"Koppoint\" value='"+oppoint+
				"'/><input type=\"text\" id=\"Kopdedu\" hidden=\"hidden\" name=\"Kopdedu\" value='"+opdedu+
				"'/><input type=\"text\" id=\"Kopcoupon\" hidden=\"hidden\" name=\"Kopcoupon\" value='"+opcoupon+"'/>"+optotal+

			"</td><td style=\"font-size: 14px;text-align: center;\"><input type=\"text\" id=\"Kmuchsellerprice\" hidden=\"hidden\" name=\"Kmuchsellerprice\" value='"+muchsellerprice+
				"'/><input type=\"text\" id=\"Kmppoint\" hidden=\"hidden\" name=\"Kmppoint\" value='"+mppoint+
				"'/><input type=\"text\" id=\"Kmpdedu\" hidden=\"hidden\" name=\"Kmpdedu\" value='"+mpdedu+
				"'/><input type=\"text\" id=\"Kmpcoupon\" hidden=\"hidden\" name=\"Kmpcoupon\" value='"+mpcoupon+"'/>"+mptotal+
			"</td></tr>";
			$("#tablespec").append(tr);
			$("#chooseSpecNum").text((numb+1));
			$("#specid").val((numb+1));
			    
		 	$("#specName").val(""); //商品规格名称
			$("#specNum").val("");  //此规格商品的数量
			$("#marketPrice").val("");  //分公司分公司价
			$("#stock").val(""); //库存数量
			$("input[name='multipay']").prop("checked",false);//多支付方式
			
			$("input[name='onlypaypoint']").prop("checked",false);//单独优惠支付积分类型
			$("#oppoint").val(""); //单独优惠支付积分值值
			$("input[name='onlypaydedu']").prop("checked",false);//单独优惠支付抵扣券类型值
			$("#opdedu").val(""); //单独优惠支付抵扣券值
			$("input[name='onlypaycoupon']").prop("checked",false);//单独优惠支付优惠券类型值
			$("#opcoupon").val(""); //单独优惠支付积教育分值
			
			$("input[name='mpayprice']").prop("checked",false);//组合货币支付类型值
			
			$("#muchsellerprice").val(""); //组合支付货币支付价格
			$("input[name='mpaypoint']").prop("checked",false);//组合支付积分值类型值
			$("#mppoint").val(""); //组合支付积分值值
			$("input[name='mpaydedu']").prop("checked",false);//组合支付抵扣券类型值
			$("#mpdedu").val(""); //组合支付抵扣券值
			$("input[name='mpaycoupon']").prop("checked",false);///组合支付优惠券类型值
			$("#mpcoupon").val(""); //组合支付积教育分值
		}
  }
function deltTablElement(){
      var check = document.getElementsByName("specChecks");
      var ths=check.length;
      var numb=parseFloat($("#chooseSpecNum").html());
      for(var i=0;i<check.length;i++){
          if(check[i].checked){
               document.getElementById('tablespec').deleteRow(i);
               i--;
               numb--;
          }
      }
      $("#chooseSpecNum").text((numb));
      $("#specid").val((numb));
  }
var imagesXiang;
//var InXiang=$("#Intditl").val();
function toXiang(){
	 //var InXiang=$("#Intditl").val();
	 //InXiang=parseInt(InXiang)+1;
	imagesXiang = Kit.dialog("详情图片","${BASE_PATH}/exchange/goods/imageDetailIndex/${LunBoNum}",{closable:true,size:"size-wide"}).open();
	//alert(InXiang)
}

var kindEditor;
kindEditor = KindEditor.create($("textarea[name='content']"), {
	width:'100%',
	height:'300px',
	resizeType :0,//2或1或0，2时可以拖动改变宽度和高度，1时只能改变高度，0时不能拖动。
	langType : 'zh_CN',
    allowUpload : true, 
    allowImageRemote: false,
    uploadJson : '${BASE_PATH}/exchange/goods/uploadimg',
	items : [
		'preview','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
		'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
		'insertunorderedlist', '|', 'emoticons', 'image', 'link'], 
	afterCreate : function() {this.sync();}, 
    afterBlur:function() {this.sync();} 
 });
//点击事件取下级的值
$("#categoryonid").change(function(){
	categoryonid=$("#categoryonid").val();
	  $.ajax({
           type: "POST",
           url: "${BASE_PATH}/exchange/goods/categoryonid",
           data: {"categoryonid" : categoryonid},
           dataType: "json",
           traditional: true,
           success: function(data){
			$("#categorytwid").empty();
			$("#categorytwid").append("<option value=''>请选择二级分类</option>");
			for(var i=0; i<data.object.length;i++){
				$("#categorytwid").append("<option value='"+data.object[i].categoryId+"'>"+data.object[i].categoryName+"</option>");
               }
           }
       });
    });
$("#categorytwid").change(function(){
	categorytwid=$("#categorytwid").val();
	  $.ajax({
           type: "POST",
           url: "${BASE_PATH}/exchange/goods/categorytwid",
           data: {"categorytwid" : categorytwid},
           dataType: "json",
           traditional: true,
           success: function(data){
          	   $("#categorythid").empty(); 
               $("#categorythid").append("<option value=''>请选择三级分类</option>");
               for(var i=0; i<data.object.length;i++){
              	 $("#categorythid").append("<option value='"+data.object[i].categoryId+"'>"+data.object[i].categoryName+"</option>");
               }
           }
       });
    });
$("#categorythid").change(function(){
	categorythid=$("#categorythid").val();
	  $.ajax({
           type: "POST",
           url: "${BASE_PATH}/exchange/goods/categorythid",
           data: {"categorythid" : categorythid},
           dataType: "json",
           traditional: true,
           success: function(data){
          	   $("#categoryfoid").empty(); 
               $("#categoryfoid").append("<option value=''>请选择四级分类</option>");
               for(var i=0; i<data.object.length;i++){
              	 $("#categoryfoid").append("<option value='"+data.object[i].categoryId+"'>"+data.object[i].categoryName+"</option>");
               }
           }
       });
    });
</script> 
<form id="addForm" action="${BASE_PATH}/exchange/goods/doAdd" method="post" enctype="multipart/form-data" class="form-horizontal" style="">
	
	<div class="form-group"  style="margin-left: 20px">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">兑换商品基本信息</label>
		<span style="margin-left:10px; color:red;">(*)</span><span  style="margin-right:10px; ">标记的为必填项</span>
	</div>
	<hr style=" height:2px;border:none;border-top:2px solid black;" />
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品名称</label>
	    <div class="col-lg-9">
        	<input type="text" name="names" id="names" class="form-control" placeholder="请输入宝贝名称" required maxlength="40"><span>此处文字不多于40字</span>
	    </div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品主图</label>
		<div class="col-sm-10">
			<input type="file" id="goodsthumb" name="goodsthumb"  style="width:30%;" accept="image/jpg,image/png" title="添加商品Logo图">
		</div>
	</div>
	<div class="form-group">
	<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>轮播图片</label>
		<div class="col-sm-10">
		 <input type='button' value='添加轮播图' onclick="toUploadImages();" style="background-color: #428bca;width: 89.81px;height: 32px;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> 
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success"></span></div>
	</div>
	<c:if test="${userid==20 }">
	<div class="form-group">
	    <label class="col-lg-2 control-label">商品货号</label>
	    <div class="col-lg-9">
        	<input type="text" id="goodsNum" name="goodsNum" class="form-control" placeholder="请输入第三方商品货号">
	    </div>
	</div>
	</c:if>
	<%-- <div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品类目</label>
	    <div class="col-lg-9">
    		<select id="categoryonid" name="categoryonid" class="selectpicker" data-width="24%" data-url="${BASE_PATH}/api/category" data-isfirst="true" data-next="#categorytwid" data-key="id:name"></select>
			<select id="categorytwid" name="categorytwid" class="selectpicker" data-width="24%" data-url="${BASE_PATH}/api/categorys/{value}"  data-key="id:name"></select>			
	    </div>
	</div> --%>
	<!-- =========================================================商品分类======================================================== -->
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>商品类别</label>
	    <div class="col-sm-2">
        	<select name="categoryonid" id="categoryonid" class="form-control" required >
       			<option value="">一级分类</option>
       			<c:forEach items="${oneCategories}" var="category" varStatus="s">
					<option value="${category.categoryId}">${category.categoryName}</option>	
				</c:forEach>
        	</select>
	    </div>
	
	    <div class="col-sm-2">
        	<select name="categorytwid" id="categorytwid" class="form-control" required >
        		<option value=""   >二级分类</option>
        	</select>
	    </div>
	
	    <div class="col-sm-2">
		    <select name="categorythid" id="categorythid" class="form-control" required >
	        	<option value=""   >三级分类</option>
	        </select>
	    </div>
	
	    <div class="col-sm-2">
		    <select name="categoryfoid" id="categoryfoid" class="form-control" required >
	        	<option value=""   >四级分类</option>
	        </select>
	    </div>
	</div>
		
		
		
		<!-- ================================================================================================================= -->
	<!-- =========================================商品标签============================================= -->
	<div class="form-group">
	<label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>市场价格</label>
		<div class="col-lg-9">
			<input type="text" id="sellPrice" name="sellPrice" class="form-control" placeholder="市场上商品的价格">
		</div>
	</div>
	<div class="form-group">
	<label class="col-lg-2 control-label">商品标签</label>
		<div class="col-lg-9">
		<select id="sTitle" name="sTitle" class="selectpicker" data-width="24%"  data-width="12%" >
				<option id="lableId" value="0">选择标签</option>
			<c:forEach items="${allTitle}" var="title">
				<option id="lableId" value="${title.id}">${title.title}</option>
			</c:forEach>
		</select>
		</div>
	</div>
	<!-- ******************************************************************************** -->
	<div class="form-group">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">商品规格设置</label>
	</div>
		<hr style=" height:2px;border:none;border-top:2px solid black;" />
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>规格名称</label>
	    <div class="col-lg-9">
        	<input type="text" name="specName" id="specName" class="form-control" placeholder="请输入商品规格名称"  maxlength="20"><span>此处文字不多于20字</span>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>规格商品数量</label>
	    <div class="col-lg-9">
        	<input type="text" name="specNum" id="specNum" class="form-control" placeholder="请输入商品规格数量" onkeyup="(this.v123=function(){this.value=this.value.replace(/[^0-9]+/,'');}).call(this)" onblur="this.v123();" maxlength="20" /><span>例：5包/提，请输入5</span>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>分公司价</label>
	    <div class="col-lg-9">
        	<input type="text" name="marketPrice" id="marketPrice" class="form-control" placeholder="请输入商品分公司价" />
	    </div>
	</div>
		<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>库存数量</label>
	    <div class="col-lg-9">
        	<input type="text" id="stock" name="stock" class="form-control" onkeyup="(this.v4=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v4();" placeholder="请输入商品库存" />
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>支付方式</label>
	    <div class="col-lg-9 mpay" >
	        <label><input name="multipay" type="radio" value="2" />优惠支付</label>
        	<div style="margin-left: 30px;" id="payonlyactivity">
				<label><input name="onlypaypoint" type="checkbox" value="1" /> 积分值 
					<input type="text" name="oppoint" id="oppoint" size="12"  placeholder="请输入数字" /></label><br>
				<label><input name="onlypaydedu" type="checkbox" value="1" /> 抵扣券
					<input type="text" name="opdedu" id="opdedu" size="12"  placeholder="请输入数字" /></label><br>
				<label><input name="onlypaycoupon" type="checkbox" value="1" /> 优惠券
					<input type="text" name="opcoupon" id="opcoupon" size="12" placeholder="请输入数字" /></label><br>
			</div>
			<label><input name="multipay" type="radio" value="3" />组合支付</label>
        	<div style="margin-left: 30px;" id="paymoneyandactivity">
      			<label><input name="mpayprice" type="checkbox" value="1" />货币值
      				<input type="text" name="muchsellerprice" id="muchsellerprice" size="12" onkeyup="(this.v11=function(){this.value=this.value.replace(/[^0-9-.]+/,'');}).call(this)" onblur="this.v11();" placeholder="元" /></label><br>
				<label><input name="mpaypoint" type="checkbox" value="1" /> 积分值 
					<input type="text" name="mppoint" id="mppoint" size="12"  placeholder="请输入数字" /></label><br>
				<label><input name="mpaydedu" type="checkbox" value="1" /> 抵扣券
					<input type="text" name="mpdedu" id="mpdedu" size="12"  placeholder="请输入数字" /></label><br>
				<label><input name="mpaycoupon" type="checkbox" value="1" /> 优惠券
					<input type="text" name="mpcoupon" id="mpcoupon" size="12" placeholder="请输入数字" /></label><br>
			</div>
	    </div>
	</div>
		<div class="form-group">
	    <label class="col-lg-2 control-label"><span style="margin-right:10px; color:red;">*</span>保存删除规格</label>
	    <div class="col-lg-9">
    		<input type="button" value="添加规格" onclick="addSpec();" style="background-color: #0080ff;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> <span>已加规格(<span id="chooseSpecNum" >0</span>)</span>
    		<input type='button' value='删除规格' id='delTablea'  onclick="deltTablElement();" style="background-color: #ff8080;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#ff8080 0,#ff0000 100%);"/>
    		<input type="text" id="specid" name="specid" hidden="hidden" value="0"/>
	    </div>
	</div>
	<div class="form-group">
    	<label class="col-lg-2 control-label"></label>
	     <div class="col-lg-9">
	     	<table id="tablespec" style="width: 100%" border="1">
     			<tr>
     				<th style=" width:5%;font-size: 14px;text-align: center;"><input type="checkbox" name="specChecks" hidden="hidden"/>选择</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">规格名称</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">规格数量</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">门市价/元</th>
     				<th style=" width:15%;font-size: 14px;text-align: center;">库存数量</th>	
     				<th style=" width:15%;font-size: 14px;text-align: center;">优惠类型</th>
     				<th style=" width:20%;font-size: 14px;text-align: center;">货币/优惠类型</th> 
     			</tr>
	     	</table>
	    </div>
	</div>
	
	<div class="form-group">
		<label class=" control-label" style="margin-left: 50px;font-size: 18px;">图文描述</label>
	</div>
		<hr style=" height:2px;border:none;border-top:2px solid black;"/>
	
	<div class="form-group">
		<label class="col-sm-2 control-label">短介绍：</label>
		<div class="col-sm-10">
	        <textarea rows="5" cols="80" name="shortinfo" maxlength="200" onchange="this.value=this.value.substring(0, 200)" onkeydown="this.value=this.value.substring(0, 200)" onkeyup="this.value=this.value.substring(0, 200)" placeholder="商品短介绍：如活动、独有特性" ></textarea>
		</div>
	</div>
	<!-- <div class="form-group">
		<label class="col-lg-2 control-label">商品内容：</label>
		<div class="col-lg-8">
			 <textarea name="content" class="form-control" rows="" placeholder="图文详情" required></textarea>
		</div>
	</div> -->
	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>详情图片</label>
		<div class="col-sm-10">
		 <input type='button' value='添加详情图片' onclick="toXiang();" style="background-color: #337ab7;width: 100px;height: 32px;color: white;border: 2px solid;background-image: linear-gradient(to bottom,#5bc0de 0,#428bca 100%);"/> 
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success"></span></div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label">提交备注</label>
		<div class="col-sm-10">
	        <textarea rows="5" cols="80" name="beizhu" maxlength="200" onchange="this.value=this.value.substring(0, 200)" onkeydown="this.value=this.value.substring(0, 200)" onkeyup="this.value=this.value.substring(0, 200)" placeholder="请在提交产品或重新上传商品时，在此处书写产品信息修改的内容。以便管理员尽快完成审核" ></textarea>
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>客服二维码</label>
		<div class="col-sm-10">
			<input type="file" id="Qrthumb" name="Qrthumb"  style="width:30%;" accept="image/jpg,image/png" title="添加客服二维码">
		</div>
	</div>
	<div class="row">
		<div class="col-lg-6"><button class="btn btn-primary col-sm-3 pull-right" type="submit" autocomplete="off" >提交</button></div>
		<div class="col-lg-6"><button class="btn btn-default col-sm-3 pull-left"  type="button" onclick="javascript:addDialog.close();" autocomplete="off">取消</button></div>
	</div>
	<input type="hidden" name="LunBoNum"  value="${LunBoNum}"/>
	<input type="hidden" name="IntLun" id="IntLun" value="0"/>
	<input type="hidden" name="Intditl" id="Intditl"  value="0"/>
</form>


